import lejos.nxt.Button;
import lejos.nxt.LCD;
import lejos.nxt.MotorPort;
import lejos.nxt.SensorPort;


public class DigiInput {
	public DigiInput() {
		SensorPort.S1.setSensorPinMode(0, 1);
		SensorPort.S1.setSensorPinMode(1, 1);
		
		MotorPort.A.controlMotor(100, MotorPort.FORWARD);
		
		while(Button.ESCAPE.isUp()) {
			if(SensorPort.S1.getSensorPin(0) == 0) {
				MotorPort.A.controlMotor(100, MotorPort.STOP);
				System.out.println("Enter druecken!");
				Button.ENTER.waitForPress();
				LCD.clear();
				MotorPort.A.controlMotor(100, MotorPort.BACKWARD);
				try {
				Thread.sleep(500);
				}
				catch (Exception e) {
					
				}
			}
			else if(SensorPort.S1.getSensorPin(1) == 0) {
				MotorPort.A.controlMotor(100, MotorPort.STOP);
				System.out.println("Enter druecken!");
				Button.ENTER.waitForPress();
				LCD.clear();
				MotorPort.A.controlMotor(100, MotorPort.FORWARD);
				try {
					Thread.sleep(500);
					}
					catch (Exception e) {
						
					}
			}
		}
	}
	
	
	public  static void main(String[] args) {
		new DigiInput();
	}
}
